package lessons6;

/**
 * StringBuffer类——常用方法
 */
public class lessons6_2 {
    public static void main(String[] args) {
        StringBuffer sBuffer = new StringBuffer("abc");

        System.out.println("\nStringBuffer类——常用方法演示:"+sBuffer);
        System.out.println("添加字符bcd到字符末尾:"+sBuffer.append("bcd"));
        System.out.println("3位置插入字符串AAA:"+sBuffer.insert(3,"AAA"));
        System.out.println("移除对象中指定位置3的字符:"+sBuffer.deleteCharAt(3));
        System.out.println("移除对象3-5的字符:"+sBuffer.delete(3,5));
        System.out.println("3-5的字符替换为BBB:"+sBuffer.replace(3,5,"BBB"));
        sBuffer.setCharAt(3,'F');
        System.out.println("修改3位置字符为F:"+sBuffer);
        System.out.println("其反转形式取代:"+sBuffer.reverse());
    }
}
